package com.kkkk.rest.common.properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @Author wangy
 * @Date 2021/1/27 14:31
 */
@ConfigurationProperties(prefix = "app.common")
@Component
public class AppCommonProperties {
    /**
     * 应用名字
     */
    private String appName;

    @Value("${spring.application.name}")
    private String defaultName;

    public String getAppName() {

        if (appName == null) {
            return defaultName;
        }
        return appName;
    }
}
